package com.sgam.mf.web;

import java.net.URLEncoder;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import com.sgam.mf.domain.ref.RefBank;
import com.sgam.mf.domain.sys.DBStoredFile;
import com.sgam.mf.helper.ProxyCurrentUser;
import com.sgam.mf.service.ref.RefBankService;
import com.sgam.mf.service.sys.SysDBStoredFileService;

@Controller
public class TestController {
		
	protected final Logger log = Logger.getLogger(getClass());
	
	
	@Autowired private RefBankService 				refBankService;
	
	@Autowired private SysDBStoredFileService 		sysDBStoredFileService;
    

	
    @RequestMapping("/modelTester")
    public String modelTester( Model model , HttpServletRequest request ) {
    	log.debug("TestController - modelTester");
         
         model.addAttribute("listDBStoredFile", listDBStoredFile());
    	
       return "modelTester";
    }
    
    
  //  @ModelAttribute("refBankCBX")
  	public List<RefBank> refBankCBX() {
	   log.debug("AppController - refBankCBX");
    	return refBankService.list(new ProxyCurrentUser()); 
  	}  
    
  	
  	public List<DBStoredFile> listDBStoredFile() {
 	   log.debug("AppController - listDBStoredFile");
     	return sysDBStoredFileService.list(new ProxyCurrentUser()); 
   	}  
 	
  	
  	
}
